//
//  VideoPlayerObserver.swift
//  VideoPlayer
//
//  Created by JY_NEW on 2021/10/13.
//

import Foundation
import FXEvent

/// 用于观察VideoPlayerManager的相关操作通知，统一管理VideoPlayerManager的事件分发
public class VideoPlayerManagerObserver: VideoPlayerManagerObserverType {
    /// 播放状态改变
    public let status = FXEvent<VideoPlayerStatus>()
    /// 网络状态改变
    public let networkStatus = FXEvent<VideoPlayerNetworkStatus>()
    
    /// 全屏状态改变
    public let fullScreen = FXEvent<Bool>()
    /// 自动横竖屏改变
    public let shouldAutorotate = FXEvent<Bool>()

    /// 播放速率改变
    public let rate = FXEvent<Float>()
    /// 播放声音大小改变
    public let volume = FXEvent<Float>()
    
    /// 当前播放时间改变（这个太频繁了）
//    public let currentTime = FXEvent<TimeInterval>()
    /// 视频长度改变
    public let duration = FXEvent<TimeInterval>()
    /// 可播放长度改变
    public let playableDuration = FXEvent<TimeInterval>()
    
    /// 视频显示模式改变
    public let videoGravity = FXEvent<VideoPlayerGravity>()
    
    /// 播放链接改变
    public let url = FXEvent<URL?>()
}
/// 用于观察layerManager的相关操作通知，统一管理layerManager的事件分发
public class VideoPlayerLayerManagerObserver: VideoPlayerLayerManagerObserverType {
    /// 控制层锁定状态改变
    public let controlLocked = FXEvent<Bool>()
    /// 浮层状态改变
    public let layerStatus = FXEvent<VideoPlayerLayerType>()
    
    /// 单击
    public let singleTap = FXEvent<UITapGestureRecognizer>()
    /// 双击
    public let doubleTap = FXEvent<UITapGestureRecognizer>()
    /// 长按
    public let longPress = FXEvent<UILongPressGestureRecognizer>()
    /// 拖动
    public let drag = FXEvent<VideoPlayerLayerDragInfo>()
}
